﻿using FluentValidation;

namespace IdentityService.WebAPI.Controllers.Login.Request;
public record ChangeMyPasswordRequest(string Password, string Password2);
public class ChangePasswordRequestValidator : AbstractValidator<ChangeMyPasswordRequest>
{
    public ChangePasswordRequestValidator()
    {
        RuleFor(e => e.Password)
            .NotNull().WithMessage("输入密码不能为空")
            .NotEmpty().WithMessage("输入密码不能为空")
            .MinimumLength(6).WithMessage("密码长度不能小于6")
            .Equal(e => e.Password2).WithMessage("两次输入密码不同");
        RuleFor(e => e.Password2)
            .NotNull().WithMessage("比较密码不同")
            .NotEmpty().WithMessage("比较密码不同");
    }
}
